<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-transform">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>404-Not Found</title>

    <style>
        .not-found-page .content {
            width: 992px;
            margin: 0 auto 80px;
            display: block;
            position: relative;
        }

        .not-found-page .content .top-img {
            display: block;
            width: 288px;
            margin: 0 auto;
        }

        .not-found-page .content .info {
            font-size: 14px;
            margin: 0 auto;
            text-align: center;
        }

        .not-found-page .content .info h2 {
            font-size: 26px;
            color: #444;
            line-height: 30px;
        }

        .not-found-page .content .info .state {
            color: #777;
            margin: 7px 0 35px;
            font-size: 16px;
            line-height: 20px;
        }

        .red-link {
            color: #9A0000;
        }

        .green-link {
            color: #0d8245;
        }
    </style>
</head>


<body style="zoom: 1;">
    <div class="not-found-page">
        <div class="content">
            <img src="admin/images/img_404.png" class="top-img">
            <div class="info">
                <h1>404</h1>
                <h2>页面走丢啦~</h2>
                <p class="state">系统找不到该页面或页面正在开发中，你可以<a id="backHome" href="" target="_self"
                        class="green-link">返回首页</a></p>
                <div class="search"></div>
            </div>
        </div>
    </div>

</body>
<script>
    window.onload = function (){
        let back = document.getElementById("backHome");
        console.log(back);
        //获取完整路径
        let curWwwPath = window.document.location.href;
        //获取主机地址之后的目录，如： index.jsp
        let pathName = window.document.location.pathname;
        let pos = curWwwPath.indexOf(pathName);
        //获取主机地址，如： http://localhost:8080
        let localhostPaht = curWwwPath.substring(0, pos);
        console.log(localhostPaht);
        back.setAttribute('href', localhostPaht);
        console.log(back);

    }



</script>
</html>